/**
 * LabController.java
 *
 * Enterprise Java
 *
 * Author:  Matthew Braddy
 * Created: Nov 22, 2010
 *
 */

package java113.labs;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Properties;
import java113.dataAccess.DataManager;

/**
 *
 * @author Matthew Braddy
 */
public class LabController {
    
    Properties properties;

    public LabController(Properties properties) {

        this.properties = properties;

    }

    public void run() throws Exception {

        DataManager m_oDataManager = new DataManager(properties);

        NameDAO nameDAO = new NameDAO(properties, m_oDataManager);
        ArrayList names = nameDAO.getAllNames();

        for (Iterator it = names.iterator(); it.hasNext();) {

            Name name = (Name) it.next();
            AddressDAO addressDAO = new AddressDAO(properties, m_oDataManager);
            Address address = addressDAO.getAddress(name.getAddress_id());

            ClassificationDAO classificationDAO = new ClassificationDAO(properties, m_oDataManager);
            Classification classification = classificationDAO.getClassification(name.getClassification_id());

            System.out.println(name.toString());

            System.out.println(classification.toString());

            System.out.println(address.toString());
        }

    }

}
